{{template "main-top" .}}

<div class="lgn-head">
    <h1>{{t "EmailVerification.Title"}}</h1>
    {{ template "user-profile" . }}

    <p>{{t "EmailVerification.Description"}}</p>
</div>

<form action="{{ mailVerificationUrl }}" method="POST">

    {{ .CSRF }}

    <input type="hidden" name="authRequestID" value="{{ .AuthReqID }}" />
    <input type="hidden" name="userID" value="{{ .UserID }}" />
    <input type="hidden" name="orgID" value="{{ .OrgID }}" />

    <div class="fields">
        <label class="lgn-label" for="code">{{t "EmailVerification.CodeLabel"}}</label>
        <input class="lgn-input" type="text" id="code" name="code" autocomplete="off" value="{{ .Code }}" {{if not .Code}}autofocus{{end}} required>
    </div>

    {{ if .PasswordInit }}
    <div class="field">
        <label class="lgn-label" for="password">{{t "InitUser.NewPasswordLabel"}}</label>
        <input data-minlength="{{ .MinLength }}" data-has-uppercase="{{ .HasUppercase }}"
               data-has-lowercase="{{ .HasLowercase }}" data-has-number="{{ .HasNumber }}"
               data-has-symbol="{{ .HasSymbol }}" class="lgn-input" type="password" id="password" name="password"
               autocomplete="new-password" autofocus required>
    </div>
    <div class="field">
        <label class="lgn-label" for="passwordconfirm">{{t "InitUser.NewPasswordConfirm"}}</label>
        <input class="lgn-input" type="password" id="passwordconfirm" name="passwordconfirm"
               autocomplete="new-password" autofocus required>
        {{ template "password-complexity-policy-description" . }}
    </div>
    {{ end }}

    {{ template "error-message" .}}

    <div class="lgn-actions lgn-reverse-order">
        <button type="submit" id="{{if.PasswordInit}}init-button{{else}}submit-button{{end}}" name="resend" value="false"
        class="lgn-primary lgn-raised-button">{{t "EmailVerification.NextButtonText"}}
        </button>

        <span class="fill-space"></span>

        {{ if .UserID }}
        <button type="submit" name="resend" value="true" class="lgn-stroked-button" formnovalidate>{{t "EmailVerification.ResendButtonText"}}</button>
        {{ end }}

        <a class="lgn-icon-button lgn-left-action" name="resetlinking" value="true" href="{{ loginUrl }}"
            formnovalidate>
            <i class="lgn-icon-arrow-left-solid"></i>
        </a>
    </div>
</form>
<script src="{{ resourceUrl "scripts/form_submit.js" }}"></script>
{{ if .PasswordInit }}
<script src="{{ resourceUrl "scripts/password_policy_check.js" }}"></script>
<script src="{{ resourceUrl "scripts/init_password_check.js" }}"></script>
{{ else }}
<script src="{{ resourceUrl "scripts/default_form_validation.js" }}"></script>
{{ end }}

{{template "main-bottom" .}}
